/*
 * Name: Joon Ho Cho
 * Date: 10/24/2008
 * Course: 15-437
 */
package scheduler.formbean;

import java.util.ArrayList;
import java.util.List;

public class AddBookmarkForm {
	private String name = "";
	private String url = "";
	private String comment = "";
	
	public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public List<String> getValidationErrors() {
		List<String> errors = new ArrayList<String>();

		if (name == null || name.length() == 0) {
			errors.add("Bookmark name is required.");
		}
		
		if (url == null || url.length() == 0) {
			errors.add("URL is required.");
		}
		
		return errors;
	}
	
	public boolean isEmpty() {
		if (name.equals("") &&
		    url.equals(""))
		    return true;
		return false;
	}
}
